package com.yaodian100.ec.generatepage.web;

import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import javax.imageio.ImageIO;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.FastDateFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
import com.yaodian100.core.common.utils.DateUtil;
import com.yaodian100.ec.common.EcConstant;
import com.yaodian100.ec.generate.entity.EventImage;
import com.yaodian100.ec.generate.entity.GenerateAdvertise;
import com.yaodian100.ec.generate.entity.GenerateContent;
import com.yaodian100.ec.generate.entity.GeneratePosition;
import com.yaodian100.ec.generate.service.GenerateService;
import com.yaodian100.ec.generatepage.entity.IdxBrandRecommendAdv;
import com.yaodian100.ec.generatepage.entity.IdxBrandRecommendProd;

public class IdxBrandRecommendAction extends ActionSupport implements Preparable {
	
	private static final long serialVersionUID = -8813792891128768864L;
	
	private final Logger logger = LoggerFactory.getLogger(IdxBrandRecommendAction.class);
	
	private GenerateService generateService;
	
	private GenerateAdvertise advertise;
	
	private GeneratePosition position;
	
	private GenerateContent content;
	
	private StringBuilder contents;
	
	private EventImage eventImage;
	
	private String createUser;
	private Date createDate;
	private String modifyUser;
	private Date modifyDate;
	private boolean doClone;
	private String from;
	
	/**
	 * 日期格式化
	 */
	protected final DateFormat PATTERN_DATE_FORMAT = new SimpleDateFormat(EcConstant.PATTERN_TIMESTAMP);
	private final int BRAND_SIZE = 10;
	private final int PROD_SIZE = 3;
	protected final String lineBreak = "\n";
	
	/**
	 * 广告ID
	 */
	private String advId;
	
	/**
	 * 广告状态
	 * 
	 * 00: 草稿, 10: 发送, 20: 放送中, 80: 过期, 90: 占停
	 */
	private String advStatus;
	
	/**
	 * OPTION CODE
	 */
	private String advType = "IDX_BRAND_RECOMMEND";
	private Map<String, String> brandSite;
	private Map<String, String> prodSite;
	
	/**
	 * 广告名称
	 */
	private String advName;
	
	/**
	 * 广告起始日
	 */
	private String startDate;
	
	/**
	 * 广告结束日
	 */
	private String endDate;

	/**
	 * 广告起始时间
	 */
	private String startTime;

	/**
	 * 广告结束时间
	 */
	private String endTime;
	private IdxBrandRecommendAdv[] brandAdvs;
	
	public String addIdxBrandRecommend() {
		advId = "";
		
		if( StringUtils.equalsIgnoreCase(from, "PCL") ) {
			advType = "PCL_BRAND_RECOMMEND";
		} else {
			advType = "IDX_BRAND_RECOMMEND";
		}
		
		initVariables();
		return "editIdxBrandRecommend";
	}
	
	public String saveIdxBrandRecommend() throws Exception {
		boolean boo = false;
		
		if(idxBrandRecommendValidate()) {
			contents = new StringBuilder("");
			
			for(int i = 0; i < BRAND_SIZE; i ++) {
				int no1 = i+1;
				IdxBrandRecommendAdv brand = brandAdvs[i];
				
				// 1. 图片
				if (GenerateHelper.mkDir(advType)) {
					if (StringUtils.isBlank(advId) && !doClone) { // insert
						contents.append(saveImgFile(brand.getBrandImg(), brand.getBrandImgName(), advType, "brandAdvs_brandImgName_" + no1, "brandAdvs_brandImgFolder_" + no1));
					} else { // update
						if(brand.getBrandImg() == null) {
							contents.append("brandAdvs_brandImgName_" + no1 + "=").append(brand.getBrandImgName()).append(lineBreak);
							contents.append("brandAdvs_brandImgFolder_" + no1 + "=").append(brand.getBrandImgFolder()).append(lineBreak);
						} else {
							contents.append(saveImgFile(brand.getBrandImg(), brand.getBrandImgName(), advType, "brandAdvs_brandImgName_" + no1, "brandAdvs_brandImgFolder_" + no1));
						}
					}
				}
				
				// 2. 图片连结
				contents.append("brandAdvs_brandImgLink_" + no1 + "=").append(brand.getBrandImgLink()).append(lineBreak);
				
				// 3. 广告代码
				if(StringUtils.isNotBlank(brand.getBrandImgAdWord()))
					contents.append("brandAdvs_brandImgAdWord_" + no1 + "=").append(brand.getBrandImgAdWord()).append(lineBreak);
				
				// 4. 商品
				for(int j = 0; j < PROD_SIZE; j++) {
					IdxBrandRecommendProd prod = brand.getProducts()[j];
					int no2 = j+1;
					
					contents.append("brandAdvs_products_prodId_" + no1 + "_" + no2 + "=").append(prod.getProdId()).append("\n")
						.append("brandAdvs_products_brief_" + no1 + "_" + no2 + "=").append(prod.getBrief()).append("\n")
						.append("brandAdvs_products_prodName_" + no1 + "_" + no2 + "=").append(prod.getProdName()).append("\n");
					
					if(StringUtils.isNotBlank(prod.getAdWord()))
						contents.append("brandAdvs_products_adWord_" + no1 + "_" + no2 + "=").append(prod.getAdWord()).append("\n");
				}
			}
			
			if(StringUtils.isBlank(advId)) {
				advertise = new GenerateAdvertise();
				position = new GeneratePosition();
				content = new GenerateContent();
			} else {
				advertise = generateService.get(Long.parseLong(advId));
				position = generateService.getGeneratePositionByAdvId(Long.parseLong(advId)).get(0);
				content = generateService.getGenerateContentByAdvId(Long.parseLong(advId)).get(0);
			}
			// set advertise
			advertise.setAdvType(advType);
			advertise.setAdvName(advName.trim());
			advertise.setStartDate(PATTERN_DATE_FORMAT.parse(startDate + " " + startTime + ":00"));
			advertise.setEndDate(PATTERN_DATE_FORMAT.parse(endDate + " " + endTime + ":59"));
			advertise.setAdvStatus(advStatus);
			content.setContents(contents.toString());
			
			if (StringUtils.countMatches(content.getContents(), "brandAdvs_brandImgLink_") == BRAND_SIZE) {
				if (StringUtils.isBlank(advId))
					boo = generateService.saveGenerateCombine(advertise, position, content);
				else
					boo = generateService.updateGenerateCombine(advertise, position, content);
			}
			contents.setLength(0);
			
			// 存檔後執行产档逻辑
			if( StringUtils.equalsIgnoreCase(from, "PCL") ) { 
				generateService.generaterPclBrandRecommend();
			} else {
				generateService.generaterIdxBrandRecommend();
			}
			
			if(boo) {
				advId = advertise.getId().toString();
				addActionMessage("储存成功");
				return editIdxBrandRecommend();
			}
		}
		
		return "editIdxBrandRecommend";
	}
	
	public String editIdxBrandRecommend() throws IOException {
		initVariables();
		
		if(!StringUtils.isBlank(advId)) {
			advertise = generateService.get(Long.parseLong(advId));
			position = generateService.getGeneratePositionByAdvId(Long.parseLong(advId)).get(0);
			content = generateService.getGenerateContentByAdvId(Long.parseLong(advId)).get(0);
			
			advStatus = advertise.getAdvStatus();
			advType = advertise.getAdvType();
			advName = advertise.getAdvName();
			
			startDate = FastDateFormat.getInstance(EcConstant.PATTERN_DATE).format(advertise.getStartDate());
			endDate = FastDateFormat.getInstance(EcConstant.PATTERN_DATE).format(advertise.getEndDate());
			startTime = FastDateFormat.getInstance("HH:mm").format(advertise.getStartDate());
			endTime = FastDateFormat.getInstance("HH:mm").format(advertise.getEndDate());
			
			createUser = advertise.getCreateUser();
			createDate = advertise.getCreateDate();
			modifyUser = advertise.getModifyUser();
			modifyDate = advertise.getModifyDate();
			
			readPropertise(content);
		}
		
		return "editIdxBrandRecommend";
	}
	
	public String cloneIdxBrandRecommend() throws IOException {
		initVariables();
		doClone = true;
		
		if(!StringUtils.isBlank(advId)) {
			advertise = generateService.get(Long.parseLong(advId));
			position = generateService.getGeneratePositionByAdvId(Long.parseLong(advId)).get(0);
			content = generateService.getGenerateContentByAdvId(Long.parseLong(advId)).get(0);
			
			GenerateAdvertise tmp_advertise = new GenerateAdvertise();
			BeanUtils.copyProperties(advertise, tmp_advertise, new String[] {"id", "createDate", "createUser", "modifyUser", "modifyDate"});
			advertise = tmp_advertise;
			
			GeneratePosition tmp_position = new GeneratePosition();
			BeanUtils.copyProperties(position, tmp_position, new String[] {"id", "advId", "createDate", "createUser", "modifyUser", "modifyDate"});
			position = tmp_position;
			
			GenerateContent tmp_content = new GenerateContent();
			BeanUtils.copyProperties(content, tmp_content, new String[] {"id", "advId", "createDate", "createUser", "modifyUser", "modifyDate"});
			content = tmp_content;
			
			advStatus = advertise.getAdvStatus();
			advType = advertise.getAdvType();
			advName = advertise.getAdvName();
			
			startDate = FastDateFormat.getInstance(EcConstant.PATTERN_DATE).format(advertise.getStartDate());
			endDate = FastDateFormat.getInstance(EcConstant.PATTERN_DATE).format(advertise.getEndDate());
			startTime = FastDateFormat.getInstance("HH:mm").format(advertise.getStartDate());
			endTime = FastDateFormat.getInstance("HH:mm").format(advertise.getEndDate());
			
			createUser = advertise.getCreateUser();
			createDate = advertise.getCreateDate();
			modifyUser = advertise.getModifyUser();
			modifyDate = advertise.getModifyDate();
			
			readPropertise(content);
			
			advId = null;
		}
		
		return "editIdxBrandRecommend";
	}
	
	void readPropertise(GenerateContent content) throws IOException {
		Properties prop = new Properties();
		Reader reader = new StringReader(content.getContents());
		prop.load(reader);
		reader.close();
		
		for(int i = 0; i < BRAND_SIZE; i++) {
			int no1 = i + 1;
			IdxBrandRecommendAdv brand = new IdxBrandRecommendAdv();
			brand.setBrandImgName( StringUtils.defaultString(prop.get("brandAdvs_brandImgName_" + no1).toString(), "") );
			brand.setBrandImgFolder( StringUtils.defaultString(prop.get("brandAdvs_brandImgFolder_" + no1).toString(), "") );
			brand.setBrandImgLink( StringUtils.defaultString(prop.get("brandAdvs_brandImgLink_" + no1).toString(), "") );
			if(prop.containsKey("brandAdvs_brandImgAdWord_" + no1))
				brand.setBrandImgAdWord( StringUtils.defaultString(prop.get("brandAdvs_brandImgAdWord_" + no1).toString(), "") );
			
			IdxBrandRecommendProd[] products = new IdxBrandRecommendProd[PROD_SIZE];
			for(int j = 0; j < PROD_SIZE; j++) {
				int no2 = j + 1;
				
				IdxBrandRecommendProd prod = new IdxBrandRecommendProd();
				prod.setProdId( StringUtils.defaultString(prop.get("brandAdvs_products_prodId_" + no1 + "_" + no2).toString(), "") );
				prod.setProdName( StringUtils.defaultString(prop.get("brandAdvs_products_prodName_" + no1 + "_" + no2).toString(), "") );
				prod.setBrief( StringUtils.defaultString(prop.get("brandAdvs_products_brief_" + no1 + "_" + no2).toString(), ""));
				if(prop.containsKey("brandAdvs_products_adWord_" + no1 + "_" + no2))
					prod.setAdWord( StringUtils.defaultString(prop.get("brandAdvs_products_adWord_" + no1 + "_" + no2).toString(), "") );
				
				products[j] = prod;
			}
			brand.setProducts(products);
			
			brandAdvs[i] = brand;
		}
		
	}
	
	/**
	 * 初始化变数值
	 */
	void initVariables() {
		advertise = new GenerateAdvertise();
		position = new GeneratePosition();
		content = new GenerateContent();
		
		advName = "";
		startDate = "";
		endDate = "";
		startTime = "";
		endTime = "";
		
		doClone = false;
		
		initBrand();
	}
	
	/**
	 * 储存图片
	 * 
	 * @param imgFile
	 * @param fileName
	 * @param advType
	 * @param imgName
	 * @param imgFolder
	 * @return
	 * @throws Exception
	 */
	String saveImgFile(File imgFile, String fileName, String advType, String imgName, String imgFolder) throws Exception {
		StringBuffer sb = new StringBuffer();
		try {
			String today = FastDateFormat.getInstance(EcConstant.DEFAULT_PATTERN_DATE).format(DateUtil.getToday().getTime());
			eventImage = new EventImage();
			eventImage.setImgType(fileName.substring(fileName.lastIndexOf("."), fileName.length()));
			eventImage = generateService.saveEventImage(eventImage);
			boolean result = GenerateHelper.uploadImage(eventImage, imgFile, advType);
			if (result) {
				sb.append(imgName + "=").append(eventImage.getUuid()).append(eventImage.getImgType()).append(lineBreak);
				sb.append(imgFolder + "=").append(today).append(lineBreak);
			} else {
				sb.append(imgName + "=").append(lineBreak);
				sb.append(imgFolder + "=").append(lineBreak);
			}
		} catch (Exception e) {
			logger.error("exception :{}", e.getMessage());
		}
		return sb.toString();
	}
	
	/**
	 * 检合图片
	 * 
	 * @param imgFile
	 * @param fieldName
	 * @param fieldNameMsg
	 * @param fileName
	 * @param fileSize
	 * @param fileWidth
	 * @param fileHeight
	 * @return
	 * @throws IOException
	 */
	boolean validateFile(File imgFile, String fieldName, String fieldNameMsg, double fileSize,
			int fileWidth, int fileHeight) throws IOException {
		int error_size = 0;
		if (null != imgFile) {
			if ((imgFile.length() / 1024) > fileSize) {
				addFieldError(fieldName, fieldNameMsg + "檔案尺寸不符");
				error_size++;
			}
			
			Image image = ImageIO.read(imgFile);
			if(image != null) {
				if (image.getHeight(null) > fileHeight || image.getWidth(null) > fileWidth) {
					addFieldError(fieldName, fieldNameMsg + "檔案长度/宽度不符");
					error_size++;
				}
			} else 
				error_size++;
			
			if (error_size > 0)
				return false;
			else
				return true;
		} else {
			addFieldError(fieldName, "请选择" + fieldNameMsg + "品牌推荐上传图片");
			return false;
		}
	}
	
	/**
	 * 必填栏位验证
	 * 
	 * @return
	 */
	boolean idxBrandRecommendValidate() {
		double imgSize = 5.0;
		int imgWidth = 125;
		int imgHeight = 40;
		
		if(StringUtils.isBlank(advName)) {
			addFieldError("advName", "请输入广告名称");
		}
		
		if(StringUtils.isBlank(startDate)) {
			addFieldError("startDate", "请输入起始日期");
		}
		
		if(StringUtils.isBlank(endDate)) {
			addFieldError("endDate", "请输入结束日期");
		}
		
		if(brandAdvs != null && brandAdvs.length > 0) {
			int lc = 1;
			int rc = 1;
			for(int i = 0; i < BRAND_SIZE; i++) {
				IdxBrandRecommendAdv brand = brandAdvs[i];
				String bsite = "";
				String site = i % 2 == 0 ? "L" : "R";
				int no = i % 2 == 0 ? lc++ : rc++;
				if(brand.getAdvPosition() == null || brand.getAdvPosition().length() == 0) {
					bsite = generateBrandSite().get(site + no);
				} else 
					bsite = generateBrandSite().get(brand.getAdvPosition());
				
				try {
					if(StringUtils.isBlank(advId) && !doClone) {
						validateFile(brand.getBrandImg(), "brandAdvs_brandImg_" + (i+1), bsite + "上传图片", imgSize, imgWidth, imgHeight);
					} else {
						if(brand.getBrandImg() != null) {
							validateFile(brand.getBrandImg(), "brandAdvs_brandImg_" + (i+1), bsite + "上传图片", imgSize, imgWidth, imgHeight);
						}
					}
				} catch (IOException e) {
					logger.warn("Cannot validate file. ", e);
					addFieldError("brandAdvs_brandImg_" + (i+1), "请重新选择" + bsite + "品牌推荐上传图片");
				}
				
				if(StringUtils.isBlank(brand.getBrandImgLink())) {
					addFieldError("brandAdvs_brandImgLink_" + (i+1), "请输入" + bsite + "品牌推荐图片点击连结");
				}
				
				IdxBrandRecommendProd[] products = brand.getProducts();
				if(products != null && products.length > 0) {
					for(int j = 0; j < PROD_SIZE; j++) {
						IdxBrandRecommendProd prod = products[j];
						String psite = generateProdSite().get("" + j);

						if(StringUtils.isBlank(prod.getProdId())) {
							addFieldError("brandAdvs_products_prodId_" + i + "_" + j, "請輸入" + bsite + "品牌商品编号（" + psite + "）");
						} else if(!generateService.isProductExist(prod.getProdId())) {
							addFieldError("brandAdvs_products_prodId_" + i + "_" + j, bsite + "品牌商品编号（" + psite + "）可能不存在，或是已被删除，或是不在架上");
						}
						if(StringUtils.isBlank(prod.getBrief())) {
							addFieldError("brandAdvs_products_brief_" + i + "_" + j, "请输入" + bsite + "商品小标（" + psite + "）");
						}
						if(StringUtils.isBlank(prod.getProdName())) {
							addFieldError("brandAdvs_products_prodName_" + i + "_" + j, "请输入" + bsite + "商品名称（" + psite + "）");
						}
					}
				} else {
					for(int j = 0; j < PROD_SIZE; j++) {
						String psite = generateProdSite().get("" + j);
						addFieldError("brandAdvs_products_prodId_" + i + "_" + j, "請輸入" + bsite + "品牌商品编号（" + psite + "）");
						addFieldError("brandAdvs_products_brief_" + i + "_" + j, "请输入" + bsite + "商品小标（" + psite + "）");
						addFieldError("brandAdvs_products_prodName_" + i + "_" + j, "请输入" + bsite + "商品名称（" + psite + "）");
					}
				}
			}
		} else {
			int lc = 1;
			int rc = 1;
			for(int i = 0; i < BRAND_SIZE; i++) {
				String site = i % 2 == 0 ? "L" : "R";
				int no = i % 2 == 0 ? lc++ : rc++;
				String bsite = generateBrandSite().get(site + no);
				addFieldError("brandAdvs_brandImg_" + (i+1), "请上传" + bsite + "品牌推荐图片");
				addFieldError("brandAdvs_brandImgLink_" + (i+1), "请输入" + bsite + "品牌推荐图片点击连结");
				for(int j = 0; j < PROD_SIZE; j++) {
					String psite = generateProdSite().get("" + j);
					addFieldError("brandAdvs_products_prodId_" + i + "_" + j, "請輸入" + bsite + "品牌商品编号（" + psite + "）");
					addFieldError("brandAdvs_products_brief_" + i + "_" + j, "请输入" + bsite + "商品小标（" + psite + "）");
					addFieldError("brandAdvs_products_prodName_" + i + "_" + j, "请输入" + bsite + "商品名称（" + psite + "）");
				}
			}
		}
		
		if (getFieldErrors().isEmpty()) {
			return true;
		} else {
			return false;
		}
	}
	
	Map<String, String> generateBrandSite() {
		Map<String, String> map = new HashMap<String, String>();
		
		int l = 1;
		map.put("L" + (l++), "左一");
		map.put("L" + (l++), "左二");
		map.put("L" + (l++), "左三");
		map.put("L" + (l++), "左四");
		map.put("L" + (l++), "左五");
		
		int r = 1;
		map.put("R" + (r++), "右一");
		map.put("R" + (r++), "右二");
		map.put("R" + (r++), "右三");
		map.put("R" + (r++), "右四");
		map.put("R" + (r++), "右五");
		
		return map;
	}
	
	Map<String, String> generateProdSite() {
		Map<String, String> map = new HashMap<String, String>();
		
		int s = 0;
		map.put("" + (s++), "左");
		map.put("" + (s++), "中");
		map.put("" + (s++), "右");
		
		return map;
	}
	
	void initBrand() {
		brandAdvs = new IdxBrandRecommendAdv[BRAND_SIZE];
		for(int i = 0; i < BRAND_SIZE; i++) {
			IdxBrandRecommendAdv adv = new IdxBrandRecommendAdv();
			IdxBrandRecommendProd[] products = new IdxBrandRecommendProd[PROD_SIZE];
			for(int j = 0; j < PROD_SIZE; j++) 
				products[j] = new IdxBrandRecommendProd();
			adv.setProducts(products);
			brandAdvs[i] = adv;
		}
	}
	
	@Override
	public void prepare() throws Exception {
		clearErrorsAndMessages();

		brandSite = generateBrandSite();
		prodSite = generateProdSite();
		
		if(brandAdvs == null || brandAdvs.length == 0) {
			initBrand();
		}
	}

	public GenerateService getGenerateService() {
		return generateService;
	}

	public void setGenerateService(GenerateService generateService) {
		this.generateService = generateService;
	}

	public GenerateAdvertise getAdvertise() {
		return advertise;
	}

	public void setAdvertise(GenerateAdvertise advertise) {
		this.advertise = advertise;
	}

	public GeneratePosition getPosition() {
		return position;
	}

	public void setPosition(GeneratePosition position) {
		this.position = position;
	}

	public GenerateContent getContent() {
		return content;
	}

	public void setContent(GenerateContent content) {
		this.content = content;
	}

	public StringBuilder getContents() {
		return contents;
	}

	public void setContents(StringBuilder contents) {
		this.contents = contents;
	}

	public EventImage getEventImage() {
		return eventImage;
	}

	public void setEventImage(EventImage eventImage) {
		this.eventImage = eventImage;
	}

	public String getAdvId() {
		return advId;
	}

	public void setAdvId(String advId) {
		this.advId = advId;
	}

	public String getAdvStatus() {
		return advStatus;
	}

	public void setAdvStatus(String advStatus) {
		this.advStatus = advStatus;
	}

	public String getAdvType() {
		return advType;
	}

	public void setAdvType(String advType) {
		this.advType = advType;
	}

	public String getAdvName() {
		return advName;
	}

	public void setAdvName(String advName) {
		this.advName = advName;
	}

	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public IdxBrandRecommendAdv[] getBrandAdvs() {
		return brandAdvs;
	}

	public void setBrandAdvs(IdxBrandRecommendAdv[] brandAdvs) {
		this.brandAdvs = brandAdvs;
	}

	public int getBRAND_SIZE() {
		return BRAND_SIZE;
	}

	public int getPROD_SIZE() {
		return PROD_SIZE;
	}

	public Map<String, String> getBrandSite() {
		return brandSite;
	}

	public void setBrandSite(Map<String, String> brandSite) {
		this.brandSite = brandSite;
	}

	public Map<String, String> getProdSite() {
		return prodSite;
	}

	public void setProdSite(Map<String, String> prodSite) {
		this.prodSite = prodSite;
	}

	public String getCreateUser() {
		return createUser;
	}

	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getModifyUser() {
		return modifyUser;
	}

	public void setModifyUser(String modifyUser) {
		this.modifyUser = modifyUser;
	}

	public Date getModifyDate() {
		return modifyDate;
	}

	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}

	public boolean isDoClone() {
		return doClone;
	}

	public void setDoClone(boolean doClone) {
		this.doClone = doClone;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}
	
}
